package com.css.landslide.risk.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.css.landslide.risk.entity.LandslideRiskLevel;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

;


/**
 * @author dingling
 * @desc 滑坡危险等级
 * @date 2024-09-26 16:19
 **/
@Mapper
public interface LandslideRiskLevelMapper extends BaseMapper<LandslideRiskLevel> {

    /**
     * 批量插入滑坡危险等级
     **/
    @Insert({"<script>" +
            "insert into landslide_risk_level(id,earth_quake_id,risk_value,risk_level,dz_version,geom,dz_intensity,create_time) values " +
            "<foreach collection=\"levels\" item=\"item\" separator=\",\">" +
            "(#{item.id}, #{item.earthQuakeId},#{item.riskValue},#{item.riskLevel},#{item.dzVersion},#{item.geom, typeHandler=com.css.handler.GeometryTypeHandler},#{item.dzIntensity},#{item.createTime})" +
            "</foreach>" +
            "</script>"})
    int batchInsertLandslideRiskLevel(@Param("levels") List<LandslideRiskLevel> levels);


}
